package boot.controller;

import boot.common.CommonResult;
import boot.domain.travel.Travel;
import boot.domain.wenchuang.Wenchuang;
import boot.domain.wxGoods.Goods;
import boot.domain.wxGoodsCategory.Goodscategory;
import boot.service.travelService;
import boot.service.wenchuangService;
import boot.service.wxGoodService;
import boot.service.wxGoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sound.midi.Track;
import java.util.List;

@RestController
@CrossOrigin
public class getInfo {
    @Autowired
    private wxGoodService wxGoodService;
    @Autowired
    private wenchuangService wenchuangService;
    @Autowired
    private travelService travelService;
    @Autowired
    private wxGoodsCategoryService wxGoodsCategoryService;
    @GetMapping("wxUser/getGoodsInfo")
    public CommonResult<List<Goods>> getGoodsInfo(){
        List<Goods> list = wxGoodService.getAllgoods();
//        System.out.println(list);
        return new CommonResult<List<Goods>>(200,"ok",list);
    }
    @GetMapping("wxUser/getAllCate")
    public CommonResult<List<Goodscategory>> getAllCate(){
        List<Goodscategory> list=  wxGoodsCategoryService.getAllCate();
        return new CommonResult<>(200,"ok",list);
    }
    @GetMapping("wxUser/getAllWenchuang")
    public CommonResult<List<Wenchuang>> getAllWenchuang(){
        List<Wenchuang> list=  wenchuangService.getAllWenchuang();
//        System.out.println(list);
        return new CommonResult<>(200,"ok",list);
    }
    @GetMapping("wxUser/getAllTravel")
    public CommonResult<List<Travel>> getAllTravel(){
        List<Travel> list=  travelService.getAllTravel();
//        System.out.println(list);
        return new CommonResult<>(200,"ok",list);
    }
}
